﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ProgNetComponentsDx.Tasks;
using System.IO;
using System.Collections.Concurrent;

namespace BuildHelper.Server
{
    public class User : ChatUser
    {
        public ConcurrentDictionary<string, Stream> Streams
        {
            get;
            private set;
        }
        public ConcurrentDictionary<string, bool> FinishedStreams
        {
            get;
            private set;
        }
        public User(long userId, string name)
            : base(userId, name)
        {
            Streams = new ConcurrentDictionary<string, Stream>();
            FinishedStreams = new ConcurrentDictionary<string, bool>();
        }
        public bool IsFinishedStream(string streamId)
        {
            return FinishedStreams.ContainsKey(streamId);
        }
        public Stream GetFinishedStream(string streamId)
        {
            Stream s = null;
            Streams.TryGetValue(streamId, out s);
            bool b;
            FinishedStreams.TryRemove(streamId, out b);
            return s;
        }
        public IUpdateServerServiceCallback UpdateServerServiceCallback { get; set; }
        public BaseTask Task { get; set; }

    }
}
